/*
 *  geometry.h
 *  wolf3d
 *
 *  Created by James Weatherley on 02/11/2009.
 *  Copyright 2009 James Weatherley. All rights reserved.
 *
 */
#include "../env/vector.h"

void calculateNormal(const vec3_t a,  const vec3_t b,  const vec3_t c,  vec3_t normal);

// Convex ploygon hit test.
int intersectPolygon(vec3_t* vertices, 
					 int count,
					 vec3_t intersect,
					 vec3_t normal);

// In:  Plane described by point and normal, ray described by origin and direction.
// Out: Intersection point.
//
// Returns 1 if there is an intersection, andrayDirection 0 if the ray does not intersect the plane.
int intersectPlane(const vec3_t planePoint, const vec3_t planeNormal, 
				   const vec3_t rayOrigin, const vec3_t rayDirection, 
				   vec3_t intersect);

int intersectBox(const vec3_t boxMin, const vec3_t boxMax, const vec3_t point, const vec3_t direction);